package com.example.aijiancece;

import android.content.SharedPreferences;
import android.os.Bundle;

import androidx.appcompat.app.AppCompatActivity;

import com.google.android.material.appbar.MaterialToolbar;
import com.google.android.material.switchmaterial.SwitchMaterial;

public class NotificationSettingsActivity extends AppCompatActivity {

    private static final String PREFS_NAME = "notification_settings";
    private static final String KEY_DETECTION = "detection_notification";
    private static final String KEY_SYSTEM = "system_notification";

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_notification_settings);

        MaterialToolbar toolbar = findViewById(R.id.toolbar);
        SwitchMaterial switchDetection = findViewById(R.id.switchDetection);
        SwitchMaterial switchSystem = findViewById(R.id.switchSystem);

        toolbar.setNavigationOnClickListener(v -> finish());

        SharedPreferences prefs = getSharedPreferences(PREFS_NAME, MODE_PRIVATE);
        switchDetection.setChecked(prefs.getBoolean(KEY_DETECTION, true));
        switchSystem.setChecked(prefs.getBoolean(KEY_SYSTEM, true));

        switchDetection.setOnCheckedChangeListener((buttonView, isChecked) -> {
            prefs.edit().putBoolean(KEY_DETECTION, isChecked).apply();
            // TODO: 更新通知设置
        });

        switchSystem.setOnCheckedChangeListener((buttonView, isChecked) -> {
            prefs.edit().putBoolean(KEY_SYSTEM, isChecked).apply();
            // TODO: 更新通知设置
        });
    }
} 